/****************************************************************************
 *  _____       ______  _____
 * |_   _|     |  ____|/ ____|
 *   | |  _ __ | |__  | (___    Institute of Embedded Systems
 *   | | | '_ \|  __|  \___ \   Zürcher Hochschule für Angewandte
 *  _| |_| | | | |____ ____) |  Wissenschaften
 * |_____|_| |_|______|_____/   8401 Winterthur, Switzerland
 *
 ****************************************************************************
 *
 * @version $Rev: 146 $
 * @author  $Author: bacr $
 * @date    $Date: 2013-10-02 17:56:25 +0200 (mer., 02 oct. 2013) $
 *
 ***************************************************************************/

#ifndef __PTP2_NODE_ADDRESS_H__
#define __PTP2_NODE_ADDRESS_H__

/* copy */
#ifndef __PTP_NODE_TABLE_DEFINES__
#define __PTP_NODE_TABLE_DEFINES__

typedef struct ptp2_lut_t                   ptp2_lut_t;
typedef struct ptp2_lut_entry_t             ptp2_lut_entry_t;

typedef struct ptp2_slave_t                 ptp2_slave_t;
typedef enum   ptp2_slave_step_t            ptp2_slave_step_t;

typedef struct ptp2_node_address_t          ptp2_node_address_t;

#endif

#include <stdint.h>
#include <stdbool.h>

#include "packet/packet.h"

#include "hcpp/ptp2_types.h"

/** Holds the network address of a slave */
struct ptp2_node_address_t {
    ptp2_address_type_t         type;                                   /**< entry type: layer-2, ipv4, ipv6 */
    mac_address_t               mac;                                    /**< mac to send to (could be MAC of router instead of slave) */
    bool                        vlan_present;
    uint16_t                    vlan_vid;
    uint16_t                    vlan_prio;
    union {
        ipv4_address_t          ipv4;
        ipv6_address_t          ipv6;
    };
};

bool   ptp2_node_address_init(ptp2_node_address_t *this, packet_t *request);

#endif

